package android.slc.box.core.ui;

import javafx.stage.Window;
import javafx.stage.WindowEvent;

/**
 * @author slc
 * @date 2022/09/26 下午 6:43
 */
public interface ViewLife {

    void onCreate();

    void onViewAdded();

    void onBindViewBefore();

    void onBindView();

    void onBindViewLater();

    boolean bindViewLaterRunLast();

    void onRegisterLiveEvent();

    void onViewRemoved();

    void onDestroy();

    void finish();

    void finishView();

    static void finishWindow(Window window) {
        if (window != null) {
            window.fireEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSE_REQUEST));
        }
    }
}
